import java.math.BigInteger;
import java.util.regex.Matcher;
import java.util.regex.Pattern;

public class t8 {
    public static void main(String[] args) {
        String str = "2147483647";
        String ss = "";
        str = str.trim();
        if(str.equals("") || str.charAt(0) == '.' || str.charAt(0) >='a' && str.charAt(0) <='z' || str.charAt(0) >='A' && str.charAt(0) <='Z'){
            //return 0;
            System.out.println(0);
        }
        String reg = "[+\\-]?\\d+";
        Pattern pattern = Pattern.compile(reg);
        Matcher matcher = pattern.matcher(str);
        while (matcher.find()) {
            if (matcher.start() > 0) {
                break;
            }
            ss = matcher.group();
            break;
        }
        int num = 0;
        if (ss.equals("")) {
            System.out.println(0);
            //return num;
        } else {
            BigInteger a = new BigInteger(ss);
            if (a.compareTo(new BigInteger("0"))>0  && a.compareTo(new BigInteger(Integer.MAX_VALUE+""))>=0 ) {
                num = Integer.MAX_VALUE;
            }
            if (a.compareTo(new BigInteger("0"))<0  && a.compareTo(new BigInteger(Integer.MIN_VALUE+""))<=0) {
                num = Integer.MIN_VALUE;
            }
            if (a.compareTo(new BigInteger("0"))>0 && a.compareTo(new BigInteger(Integer.MAX_VALUE+""))<0 || a.compareTo(new BigInteger("0"))<0  && a.compareTo(new BigInteger(Integer.MIN_VALUE+""))>0) {
                num = Integer.parseInt(ss);
            }
        }
       // return num;
        System.out.println(num);


    }
}
